home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 25 / Cream of the Crop 25.iso / bbs / fcfgw40s.zip / AREATOOL.CPP next >
C/C++ Source or Header  |  1996-04-18  |  1KB  |  54 lines

  1. // AreaTools.cpp : implementation file
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "FileCFG.h"
  6. #include "AreaTools.h"
  7.  
  8. #ifdef _DEBUG
  9. #define new DEBUG_NEW
  10. #undef THIS_FILE
  11. static char THIS_FILE[] = __FILE__;
  12. #endif
  13.  
  14. /////////////////////////////////////////////////////////////////////////////
  15. // CAreaTools
  16.  
  17. CAreaTools::CAreaTools():
  18.     m_pTButtons(NULL)
  19. {
  20. }
  21.  
  22. CAreaTools::~CAreaTools()
  23. {
  24.     if( m_pTButtons ) delete m_pTButtons;
  25. }
  26.  
  27.  
  28. BEGIN_MESSAGE_MAP(CAreaTools, CToolBarCtrl)
  29.     //{{AFX_MSG_MAP(CAreaTools)
  30.     //}}AFX_MSG_MAP
  31. END_MESSAGE_MAP()
  32.  
  33. BOOL CAreaTools::Create(DWORD dwStyle, const RECT &rect, CWnd *pParent, UINT nID)
  34. {
  35.     static const int nButtons = 6;
  36.  
  37.     BOOL bRet = CToolBarCtrl::Create(dwStyle, rect, pParent, nID);
  38.  
  39.     // load the bitmap
  40.     VERIFY(-1 != AddBitmap(6, IDB_BITMAP_TOOLBAR));
  41.     // load the buttons
  42.     m_pTButtons = new TBBUTTON[nButtons];
  43.     for(int nIndex = 0; nIndex < nButtons; ++nIndex){
  44.         m_pTButtons[nIndex].iString = NULL;
  45.         m_pTButtons[nIndex].fsState = TBSTATE_ENABLED;
  46.         m_pTButtons[nIndex].fsStyle = TBSTYLE_BUTTON;
  47.         m_pTButtons[nIndex].dwData = 0;
  48.         m_pTButtons[nIndex].iBitmap = nIndex;
  49.         m_pTButtons[nIndex].idCommand = ID_TOOLBAR_COMMAND + nIndex;
  50.     }
  51.     VERIFY(0 != AddButtons(nButtons, m_pTButtons));
  52.  
  53.     return bRet;
  54. }